#!/bin/bash

if [ $# -eq 0 ];
then
	echo -e "\e[31m请输入要kill的服务器ID!\e[0m"
	exit
fi

FOLDER="/home/qie${1}/code/run"
if [ ! -e $FOLDER ];then
    FOLDER="/data/qie${1}/code/run"
	if [ ! -e ${FOLDER} ];then
		FOLDER="/home/yt${1}/code/run"
		if [ ! -e ${FOLDER} ];then
			FOLDER="/data/yt${1}/code/run"
			if [ ! -e ${FOLDER} ];then
				echo -e "\e[31m${1}目录不存在!\e[0m"
				exit 1
			fi
		fi
	fi
fi

find $FOLDER/*/ -name "*.pid"|while read line
do
	PID=`cat $line`
	echo -e "终止进程PID:${PID}..."
	kill -9 $PID
	rm -rf $line
done